<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-student-edit" th:object="${student}">
            <div class="form-group">	
				<label class="col-sm-2 control-label">学号：</label>
				<div class="col-sm-4">
					<input id="studentNumber" name="studentNumber" readonly="readonly" th:field="*{studentNumber}" class="form-control required" type="text">
				</div>
				<label class="col-sm-2 control-label">姓名：</label>
				<div class="col-sm-4">
					<input id="name" name="name" th:field="*{name}" class="form-control required" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-2 control-label">性别：</label>
				<div class="col-sm-4">
					<select id="sex" class="form-control m-b required" th:with="type=${@dictService.selectDictData('sys_user_sex')}">
	                    <option th:each="dict : ${type}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}" th:field="*{sex}"></option>
	                </select>
				</div>
				<label class="col-sm-2 control-label">班级：</label>
				<div class="col-sm-4">
					<input id="classNumber" name="classNumber" th:field="*{classNumber}"  class="form-control" type="hidden"  >
					<input id="classNumberName"  class="form-control required" th:field="*{classes.name}" type="text" readonly="readonly" onclick="selectClassesTree()">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-2 control-label">IC卡号：</label>
				<div class="col-sm-4">
					<input id="icNumber" name="studentIc.icNumber" readonly="readonly" th:field="*{studentIc.icNumber}" class="form-control required" type="text">
				</div>
				<label class="col-sm-2 control-label">状态：</label>
				<div class="col-sm-4">
					<select id="status" name="status" class="form-control m-b required" th:with="type=${@dictService.selectDictData('student_status')}">
	                    <option th:each="dict : ${type}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}" th:field="*{status}"></option>
	                </select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-2 control-label">家长1：</label>
				<div class="col-sm-4">
					<div class="input-group m-b">
                         <div class="input-group-btn" style="width: 80px;">
                         	<select id="appellation1" name="parents[0].appellation" class="form-control m-b required" th:with="type=${@dictService.selectDictData('parent_appellation')}">
			                    <option value="">称谓</option>
			                    <option th:each="dict : ${type}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}" th:field="*{parents[0].appellation}"></option>
			                </select>
                         </div>
						<input id="name1" name="parents[0].name" class="form-control required" type="text" th:field="*{parents[0].name}">
						<input name="parents[0].parentId" class="form-control required" type="hidden" th:field="*{parents[0].parentId}">
                     </div>
				</div>
				<label class="col-sm-2 control-label">联系电话：</label>
				<div class="col-sm-4">
					<input id="telephone1" name="parents[0].telephone" class="form-control required" type="text" th:field="*{parents[0].telephone}">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-2 control-label">家长2：</label>
				<div class="col-sm-4">
					<div class="input-group m-b">
                         <div class="input-group-btn" style="width: 80px;">
                         	<select id="appellation2" name="parents[1].appellation" class="form-control m-b required" th:with="type=${@dictService.selectDictData('parent_appellation')}">
			                    <option value="">称谓</option>
			                    <option th:each="dict : ${type}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}" th:field="*{parents[1].appellation}"></option>
			                </select>
                         </div>
						<input id="name2" name="parents[1].name" class="form-control required" type="text" th:field="*{parents[1].name}">
						<input name="parents[1].parentId" class="form-control required" type="hidden" th:field="*{parents[1].parentId}">
                     </div>
				</div>
				<label class="col-sm-2 control-label">联系电话：</label>
				<div class="col-sm-4">
					<input id="telephone2" name="parents[1].telephone" class="form-control required" type="text" th:field="*{parents[1].telephone}">
				</div>
			</div>
			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "module/student"
		$("#form-student-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
				name:{
        			maxlength: 10
        		},
			},
			submitHandler: function(form) {
				$.operate.save(prefix + "/save", $('#form-student-edit').serialize());
			}
		});
		
		/* 选择班级树 */
		function selectClassesTree(){
			var url = ctx + "module/classes/selectClassesTree";
        	$.modal.open("选择班级", url, '380', '380');
		}
	</script>
</body>
</html>
